<template>
  <div class="card" @mouseenter="mouseIn = true" @mouseleave="mouseIn = false">
    <!-- <RouterLink :to="`https://www.dance365.com/detail/video?momentId=${video.id}&source=original`" -->
    <RouterLink :to="`/videoPlay?momentId=${video.id}`"
      >
      <div class="vedio">
        <div class="mouse-in" v-show="mouseIn"></div>
        <img class="original" v-if="video.momentClassificationBackup.classification == 'original'"
          src="https://rs.dance365.com/home_img_ycpc.png">
        <img class="play" src="https://rs.dance365.com/img/release_play@3x.fb313c4d.png">
        <img class="pic" :src="video.cover[0]">
      </div>
    </RouterLink>
    <div class="main">
      <div class="title"><img src="https://rs.dance365.com/title_original.svg">&nbsp;{{ video.title }}</div>
      <div class="flow">
        <div class="browse">
          {{ video.statisticsBackup.viewCount }}人浏览
        </div>
        <ul class="trigeminy">
          <li>
            <i class="iconfont icon-dianzan"></i>
            <span>&nbsp;{{ video.statisticsBackup.praiseCount }}</span>
          </li>
          <li>
            <i class="iconfont icon-xiaoxi"></i>
            <span>&nbsp;{{ video.statisticsBackup.commentCount }}</span>
          </li>
          <li>
            <i class="iconfont icon-star"></i>
            <span>&nbsp;{{ video.statisticsBackup.favoriteCount }}</span>
          </li>
        </ul>
      </div>
    </div>

    <div class="author">
      <div class="portrait">
        <img :src="video.creatorBackup.avatar">
        <div class="name"><span class="names">{{ video.creatorBackup.name }}</span>
          <img v-if="video.creatorBackup.certificationType" class="vip"
            src="https://rs.dance365.com/authenticate_personal@3x.png">
        </div>

      </div>
      <div class="date">{{ date }}</div>
    </div>
  </div>
</template>

<script lang="ts">
export default {
    name: "Card",
    components: { RouterLink }
}
</script>

<script setup lang="ts">
import type { ContentModel } from '@/api/mockHome'
import moment from 'moment';
import { ref } from 'vue';
import { RouterLink } from 'vue-router';

const mouseIn = ref(false)

const props = defineProps<{
  video: ContentModel
}>()

// console.log(props.video)

const date = moment(props.video.updateTime).format('MM-DD')

// console.log(date)

</script>

<style scoped lang="scss">
.card {
  width: 224px;
  background-color: #fff;
  font-size: 16px;
  border-radius: 5px;

  .vedio {
    width: 100%;
    border-radius: 5px;
    position: relative;

    .mouse-in {
      width: 100%;
      height: 126px;
      position: absolute;
      background-color: #fff;
      opacity: 0.6;
      z-index: 99;
    }

    .original {
      width: 40px;
      height: 22px;
      position: absolute;
      left: 5px;
      top: 5px;
    }

    .play {
      position: absolute;
      bottom: 6px;
      left: 10px;
      width: 30px;
      height: 30px;
    }

    .pic {
      width: 100%;
      border-radius: 5px;
      height: 126px;
      object-fit: cover;
    }
  }

  .title {
    height: 45px;
    padding-top: 8px;
    font-size: 14px;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    display: -webkit-box;

    img {
      width: 24px;
      position: relative;
      top: 4px;
    }
  }

  .main {
    padding: 0px 10px 13px;
  }

  .flow {
    font-size: 12px;
    width: 100%;

    color: #d8dbe6;

    .browse {
      height: 32px;
      line-height: 32px;
    }

    .trigeminy {
      display: flex;
      padding: 0 0 12px;
      margin: 0;

      li {
        margin-right: 18px;

        i {
          position: relative;
          top: 2px;
        }
      }
    }
  }

  .author {
    border-top: 1px solid #d8dbe6;
    display: flex;
    color: #d8dbe6;
    padding-left: 16px;
    height: 50px;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;

    .portrait {
      display: flex;
      color: #000;
      align-items: center;

      .name {
        line-height: 50px;
        margin-left: 8px;


        span {
          display: inline-block;
          margin-top: 20px;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
          width: 84px;
        }

      }

      .vip {
        position: relative;
        top: -20px;
        width: 12px;
        height: 12px;
        margin-left: 5px;
      }

      img {
        width: 24px;
        height: 24px;
        border-radius: 50%;
      }
    }

    .date {
      font-size: 14px;
      margin-right: 16px;
    }
  }
}
</style>